package com.schoolET.service.admin.adminImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.schoolET.entity.OrderForm;
import com.schoolET.entity.vo.OrderFormVO;
import com.schoolET.mapper.OrderFormMapper;
import com.schoolET.service.admin.IOrderFormService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 流水表 服务实现类
 * </p>
 *
 * @author le
 * @since 2024-06-03
 */
@Service
public class OrderFormServiceImpl extends ServiceImpl<OrderFormMapper, OrderForm> implements IOrderFormService {

    @Override
    public Page<OrderForm> selectWater(OrderFormVO orderFormVo) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        if (orderFormVo.getPosition()!=null && !orderFormVo.getPosition().isEmpty()){
            queryWrapper.like("r.position",orderFormVo.getPosition());
        }
        if (orderFormVo.getType() != null && !orderFormVo.getType().isEmpty()) {
            queryWrapper.eq("t.type",orderFormVo.getType());
        }
        if (orderFormVo.getTheme()!=null && !orderFormVo.getPosition().isEmpty()){
            queryWrapper.like("g.theme",orderFormVo.getTheme());
        }
        queryWrapper.eq("of.order_status",1);

        Page<OrderForm> page = new Page<>(orderFormVo.getPageNum(),orderFormVo.getPageSize());
        baseMapper.selectWaterPage(page,queryWrapper);
        return page;
    }
}
